#ifndef AUDIOFORMAT_H
#define AUDIOFORMAT_H

#include <string>
#include "CommonUtil.h"

typedef struct {
	int nSampleRate;
	int nBits;
	int nChannels;
	std::string encoding;
	std::string type;
	std::string endian;
} AudioFormat;

static AudioFormat createEmptyAudioFormat(void)
{
	AudioFormat format;
	format.encoding		= "";
	format.endian		= "";
	format.type			= "";
	format.nBits		= -1;
	format.nChannels	= -1;
	format.nSampleRate	= -1;
	return format;
}

static std::string getAudioFormatString(AudioFormat format)
{
	std::string ret = "";
	if (format.nSampleRate != -1)
		ret += "--rate " + toStr(format.nSampleRate) + " ";
	
	if (format.nBits != -1) 
		ret += "--bits " + toStr(format.nBits) + " ";

	if (format.nChannels != -1) 
		ret += "--channels " + toStr(format.nChannels) + " ";

	if (format.type != "") 
		ret += "--type " + format.type + " ";

	if (format.encoding != "") 
		ret += "--encoding " + format.encoding + " ";

	if (format.endian != "") 
		ret += "--endian " + format.endian + " ";

	return ret;
}

#endif
